function popupAddFriend(popupWindow,friendID,friendNick)
{
	popupWindow.html('<form id="addFriendForm"><input type="hidden" id="action" name="action" /><input type="hidden" id="friendID" name="friendID" /><div class="popup1"><div class="popup_title">您将添加'+friendNick+'为好友</div><div id="closeWindow" class="popup_close"><a href="###"><span>关闭窗口</span></a></div></div><div class="popup2"><div class="popup_btns"><input type="button" id="submitAddFriendBtn" class="btn_1" value="添加"/>&nbsp;<input type="button" id="cancelAddFriendBtn" class="btn_5" value="取消"/></div></div><div class="popup3"></div></form>');
	
	$("#addFriendForm>input[name='action']").attr('value','add');
	$("#friendID").attr('value',friendID);
	
	$("#submitAddFriendBtn").click(function()
	{
		var params = $("#addFriendForm").serializeArray();
		
		$.ajax(
		{
			type: 'post',
            url: edp_domain_url + 'ajax_friend/?tiny=1',
            data: params,
			timeout: 5000,
			global:false,
			beforeSend: function()
			{
				$.blockUI(
				{ 
					message: '正在处理...',
				    css: { padding:'5px',color:'#CC0000'}
				});
			},
			error: function()
			{
				$.blockUI(
				{ 
				    message: '添加出错...',
				    css: { padding:'5px',color:'#CC0000'}
				});
			},
			success: function(data)
			{
				$.blockUI(
				{
					message: data,
					css: { padding:'5px',color:'#CC0000'}
				});
            },
            complete: function()
            {
            	$.unblockUI();
            }
         });
	});
	
	 $("#cancelAddFriendBtn").click(function() 
	 {
		 $.unblockUI();
	 });
	   
	 $("#closeWindow>a").click(function() 
	 {
		 $.unblockUI();
	 });
}

function popupDelFriend(popupWindow,friendID,friendNick)
{
	popupWindow.html('<form id="delFriendForm"><input type="hidden" id="action" name="action" /><input type="hidden" id="friendID" name="friendID" /><div class="popup1"><div class="popup_title">您将删除好友'+friendNick+'</div><div id="closeWindow" class="popup_close"><a href="#"><span>关闭窗口</span></a></div></div><div class="popup2"><div class="popup_btns"><input type="button" id="submitDelFriendBtn" class="btn_1" value="删除"/>&nbsp;<input type="button" id="cancelDelFriendBtn" class="btn_5" value="取消"/></div><div class="popup3"></div></div></form>');
	
	$("#delFriendForm>input[name='action']").attr('value','delete');
	$("#friendID").attr('value',friendID);
	
	$("#submitDelFriendBtn").click(function()
	{
		var params = $("#delFriendForm").serializeArray();
		
		$.ajax(
		{
			type: 'post',
            url: edp_domain_url + 'ajax_friend/?tiny=1',
            data: params,
			timeout: 5000,
			global:false,
			beforeSend: function()
			{
				$.blockUI(
				{ 
					message: '正在处理...',
				    css: { padding:'5px',color:'#CC0000'}
				});
			},
			error: function()
			{
				$.blockUI(
				{ 
				    message: '删除出错...',
				    css: { padding:'5px',color:'#CC0000'}
				});
			},
			success: function(data)
			{
				$.blockUI(
				{
					message: data,
					css: { padding:'5px',color:'#CC0000'}
				});
            },
            complete: function()
            {
            	$.unblockUI();
            	window.location.reload();
            }
         });
	});
	
	 $("#cancelDelFriendBtn").click(function() 
	 {
		 $.unblockUI();
	 });
	   
	 $("#closeWindow>a").click(function() 
	 {
		 $.unblockUI();
	 });
}
